{% extends "userpage.html" %}

{% block title %}{{ cond(new_user, 'New', 'Edit') }} Account - {{super()}}{% endblock %}

{% block body %}

# if saved
	<div class="disappear success plus1" style="position:absolute;top:15px;right:15px;width:250px;text-align:center;">
		{{saved}}
	</div>
# endif

<form method="post">
<h3>{{ cond(new_user, 'New', 'Edit') }} Account</h3>

<div style="text-align:right;width:400px;" id="profile" class="plus1">
	# if auser.admin
		<div class="notice">
			<img src="/images/supercow.gif" alt="" width="46" height="40" style="vertical-align:middle;float:right;" />
			Careful.. you're editing an administrator account. &nbsp;
		</div>
	# endif
	<br />
	<label for="username">Username</label><input type="text" value="{{username or auser.username}}" name="username" id="username" /><br />
	<label for="email">Email</label><input type="text" value="{{email or auser.email}}" name="email" id="email" /><br />
	<label for="name">Name</label><input type="text" value="{{name or auser.name or ''}}" name="name" id="name" /><br />
	<label for="phone">Phone</label><input type="text" value="{{phone or auser.phone or ''}}" name="phone" id="phone" /><br />
	<label for="address">Address</label><input type="text" value="{{address or auser.address or ''}}" name="address" id="address" /><br />
	<label for="pwd">Password</label><input type="text" value="{{password or ''}}" name="password" id="pwd" /><br />
	# if not new_user
		<span style="color:#666;font-size:0.8em;">(Leave password empty to keep it the same)</span><br />
	# endif
	<br />
	# if new_user
		<br />
		<button name="action" value="new-account" type="submit" class="order-btn order-submit">Create New Account</button>
	# else
		<button name="action" value="edit-account" type="submit" class="order-btn order-submit">Update Account</button>
	# endif
	
	# if error
		<br /><br />
		<div class="disappear plus1 error" style="text-align:center;">{{error}}</div>
	# else
		<br /><br /><br />
	# endif
	
</div>
<a href="/accounts/" class="plus1">&laquo; Back to all accounts</a>
<script type="text/javascript">
	// foregoing js validation in favor of just server validation
	setTimeout(function() {
		$('.disappear.success').fadeOut();
	}, 2800);
	setTimeout(function() {
		$('.disappear.error').fadeOut();	
	}, 30 * 1000);
</script>

</form>
{% endblock %}
